//package com.chy.sprbootmanual.controller;
//
//import com.chy.sprbootmanual.bean.User;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.ModelMap;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import javax.servlet.http.HttpSession;
//import java.util.Arrays;
//import java.util.List;
//
//@Controller
//public class ThymeleafController {
//    @RequestMapping("/hello")
//    public String hello(ModelMap modelMap) throws Exception {
//        modelMap.put("welcome", "Welcome to Fd1931班");
////        使用modelMap.put将内容put到hello页面
//        return "hello";
//    }
//
////    @RequestMapping("/getUser")
////    public String getUser(ModelMap modelMap) throws Exception {
//////        选择表达式(星号语法)
////        User user = new User();
////        user.setUsername("张三");
////        user.setAddress("宝安石岩");
////        modelMap.put("user", user);
////        return "user";
////    }
//    @RequestMapping("/getUser")
//    public String getUser(ModelMap modelMap, HttpSession session) throws Exception {
////       这里是将数据放入Session然后传到前端使用
//        User user = new User();
//        user.setUsername("李四");
//        user.setAddress("宝安石岩");
//        session.setAttribute("loginUser",user);
//        return "user";
//    }
//    @RequestMapping("/userInfo")
//    public String userInfo(String id,ModelMap modelMap) throws Exception {
//        User user = new User();
//        user.setUsername("李四");
//        user.setAddress("宝安石岩");
//        modelMap.put("user", user);
//
//        System.out.println("id = " + id);
//        return "user";
//    }
//
//    @RequestMapping("/getUserList")
//    public String getUserList(String id,ModelMap modelMap) throws Exception {
//        final List<User> userList = Arrays.asList(new User("张三", "shenzhn","男"), new User("lisi", "baoan","男"), new User("wangwu", "shiyan","男"));
//        modelMap.put("users", userList);
//        System.out.println("userList = " + userList);
//        return "user";
//    }
//}
